<template>
  <el-dialog
    title="订单详情"
    :visible.sync="isShow"
    :close-on-click-modal="modalDialog"
    :close-on-press-escape="modalDialog"
    width="80%"
  >
    <div class="dialog_wrap">
      <div class="title">
        <span>订单信息</span>
        <span style="font-size: 14px;font-weight: 500;color:#e89e42;" class="ml20">
          <span v-if="detail.orderBean && detail.orderBean.payStatus === '0'">待支付</span>
          <span v-if="detail.orderBean && detail.orderBean.payStatus === '1'">超时未支付</span>
          <span v-if="detail.orderBean && detail.orderBean.payStatus === '2'">取消支付</span>
          <span v-if="detail.orderBean && detail.orderBean.payStatus === '3'">支付成功</span>
          <span v-if="detail.orderBean && detail.orderBean.payStatus === '4'">退款中</span>
          <span v-if="detail.orderBean && detail.orderBean.payStatus === '5'">退款成功</span>
        </span>
      </div>
      <div class="wrap">
        <div class="item">
          <span class="key">订单编号：</span>
          <span class="value">{{ detail.orderBean && detail.orderBean.orderId }}</span>
        </div>
        <div class="item">
          <span class="key">下单设备：</span>
          <span class="value">{{ detail.orderBean && detail.orderBean.deviceName }}</span>
        </div>
        <div class="item">
          <span class="key">下单时间：</span>
          <span class="value">{{ detail.orderBean && detail.orderBean.createTime }}</span>
        </div>
        <div class="item">
          <span class="key">实付金额：</span>
          <span class="value">{{ detail.orderBean && detail.orderBean.realPrice }}</span>
        </div>
        <div class="item">
          <span class="key">支付方式：</span>
          <span class="value">{{ detail.orderBean && detail.orderBean.payMethod }}</span>
        </div>
        <div class="item">
          <span class="key">支付时间：</span>
          <span class="value">{{ detail.orderBean && detail.orderBean.payTime }}</span>
        </div>
        <div class="item">
          <span class="key">会员姓名：</span>
          <span class="value">{{ detail.orderBean && detail.orderBean.userName }}</span>
        </div>
        <div class="item">
          <span class="key">手机号：</span>
          <span class="value">{{ detail.orderBean && detail.orderBean.phone }}</span>
        </div>
        <div class="item" />
        <div class="item">
          <span class="key">备注：</span>
          <span class="value">{{ detail.orderBean && detail.orderBean.remarks }}</span>
        </div>
      </div>
      <div class="title">
        <span>出币状态</span>
      </div>
      <div class="wrap">
        <div class="item">
          <span class="key">出币状态：</span>
          <span class="value">{{ detail.coinsBean && detail.coinsBean.issendCoin == '0' ? '未出币' : '已出币' }}</span>
        </div>
        <div class="item">
          <span class="key">出币方式：</span>
          <span v-if="detail.coinsBean && detail.coinsBean.sendType == '0'" class="value">未出币</span>
          <span v-if="detail.coinsBean && detail.coinsBean.sendType == '1'" class="value">自动出币</span>
          <span v-if="detail.coinsBean && detail.coinsBean.sendType == '2'" class="value">手动出币</span>
        </div>
        <div class="item">
          <span class="key">出币时间：</span>
          <span class="value">{{ detail.coinsBean && detail.coinsBean.sendTime }}</span>
        </div>
        <div class="item">
          <span class="key">操作人：</span>
          <span class="value">{{ detail.coinsBean && detail.coinsBean.sendUserName }}</span>
        </div>
        <div class="item">
          <span class="key">出币失败原因：</span>
          <span class="value">{{ detail.coinsBean && detail.coinsBean.resultCause }}</span>
        </div>
      </div>
      <div class="title">订单内容</div>
      <el-table
        :data="detail.items"
        border
        fit
        :header-row-class-name="'table-header'"
        class="doumee-element-table"
      >
        <el-table-column
          align="center"
          label="名称"
          prop="name"
          min-width="120"
          show-overflow-tooltip
        />
        <el-table-column
          align="center"
          label="币数量"
          prop="coinNum"
          min-width="120"
          show-overflow-tooltip
        />
        <el-table-column
          align="center"
          label="数量"
          prop="num"
          min-width="120"
          show-overflow-tooltip
        />
        <el-table-column
          align="center"
          label="销售价(元)"
          prop="originalPrice"
          min-width="120"
          show-overflow-tooltip
        />
        <el-table-column
          align="center"
          label="优惠金额(元)"
          prop="yhPrice"
          min-width="120"
          show-overflow-tooltip
        />
        <el-table-column
          align="center"
          label="实付金额(元)"
          prop="realPrice"
          min-width="120"
          show-overflow-tooltip
        />
      </el-table>
      <div class="mt30" />
    </div>

  </el-dialog>
</template>

<script>
import store from '@/store'

import { orderlistDetail } from '@/api'
export default {
  data() {
    return {
      isShow: false,
      detail: {},
      modalDialog: store.getters.dialog
    }
  },
  methods: {
    getOrderDetail(id) {
      orderlistDetail({ param: { orderId: id }}).then(res => {
        this.detail = { ...res.record }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
  .dialog_wrap{
    .title{
      font-size: 16px;
      font-weight: 800;
      margin: 20px 0px;
    }
    .wrap{
      display: flex;
      flex-wrap: wrap;
      .item{
        width: 33.33%;
        margin-bottom: 10px;
      }
    }
  }
</style>
